package dparish.client;

import com.google.gwt.activity.shared.ActivityManager;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.SimplePanel;


import dparish.client.inject.MyGinInjector;
/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class SchoolPlanner implements EntryPoint {

	// The injector. You can only have one instance in your app or else when you aske for a singleton, a new injector will get you a new copy.
	private static final MyGinInjector injector = GWT.create(MyGinInjector.class);
	
	public void onModuleLoad() {

		// ActivityManager needs a one widget panel so we create one.
		SimplePanel startPanel = new SimplePanel();

		// Start the activity manager.
		ActivityManager activityManager = injector.getActivityManager();
		activityManager.setDisplay(startPanel);
		
		// Start the PlaceHistoryManager
		PlaceHistoryHandler historyHandler =  injector.getRegisteredPlaceHistoryHandler();
		
		RootLayoutPanel.get().add(startPanel);
		
		// This call kicks off for new screens by kicking off the event we need to get everything started.
		historyHandler.handleCurrentHistory();
	}	
}

